package com.weaver.openapi.service;

import com.weaver.openapi.pojo.odoc.parms.*;
import com.weaver.openapi.pojo.*;
import com.weaver.openapi.pojo.odoc.res.*;
import com.weaver.openapi.util.*;
import java.util.*;
import cn.hutool.http.*;
import com.alibaba.fastjson.*;

public class OdocService
{
    public static ApiResult<OdocDataVo> getCustomlistData(final OdocVo odocVo, String host, final Map<String, String> headers) {
        host = HostUtil.beforeRequestCheckHeaders(host, headers, "application/json");
        final Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("access_token", odocVo.getAccessToken());
        paramMap.put("userid", odocVo.getUserid());
        paramMap.put("listId", odocVo.getListId());
        paramMap.put("tabId", odocVo.getTabId());
        paramMap.put("pageNum", odocVo.getPageNum());
        paramMap.put("pageSize", odocVo.getPageSize());
        final String resJson = ((HttpRequest)HttpRequest.post(host + "/api/odoc/list/getCustomlistData").body(JSONObject.toJSONString((Object)paramMap)).headerMap((Map)headers, true)).execute().body();
        return transferResult(resJson);
    }
    
    public static ApiResult<OdocDataVo> transferResult(final String resJson) {
        final JSONObject jsonObject = JSONObject.parseObject(resJson);
        final OdocDataVo data = (OdocDataVo)jsonObject.getObject("data", (Class)OdocDataVo.class);
        final String code = (String)jsonObject.getObject("code", (Class)String.class);
        final String msg = (String)jsonObject.getObject("msg", (Class)String.class);
        final boolean status = (boolean)jsonObject.getObject("status", (Class)Boolean.class);
        final boolean fail = (boolean)jsonObject.getObject("fail", (Class)Boolean.class);
        final ApiResult<OdocDataVo> normalRes = new ApiResult<OdocDataVo>();
        normalRes.setData(data);
        normalRes.setCode(code);
        normalRes.setMsg(msg);
        normalRes.setStatus(status);
        normalRes.setFail(fail);
        return normalRes;
    }
}
